package com.financing.wap.web.controller.api;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.common.ResultMap;
import com.financing.wap.dto.DstArticleCategoriesDTO;
import com.financing.wap.service.IDstArticleCategoriesService;
import com.financing.wap.web.controller.BaseController;

@Controller("dstArticleCategoriesController")
@RequestMapping("/api/dstArticleCategories")
public class DstArticleCategoriesController extends BaseController  { 

	private Logger logger = Logger.getLogger(getClass());
	
	@Autowired
	private IDstArticleCategoriesService dstArticleCategoriesService;
	
	/***
	 * 后台文章分类列表
	 * @param request
	 * @param dstArticleCategories
	 * @param pager
	 * @return
	 */
	@RequestMapping("/listDstArticleCategories")
	@ResponseBody
	public ResultMap list(HttpServletRequest request, DstArticleCategoriesDTO dstArticleCategories){
		ResultMap result = new ResultMap();
		
		try{
			logger.info("query dstArticleCategories list begin .......");
			dstArticleCategories.setArticleTypeStatus("1");
			dstArticleCategories.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
			List<DstArticleCategoriesDTO> dstArticleCategoriesList = dstArticleCategoriesService.queryList(dstArticleCategories);
			result.setAttribute("list", dstArticleCategoriesList);
			result.setStatusCode(ResultMap.STATUS_CODE_SUCCESS);
			result.setStatus(ResultMap.STATUS.SUCCESS);
			
			logger.info("query dstArticleCategories list end .......");
		}catch(Exception e){
			log.error("query dstArticleCategories error!",e);
			result.setStatus(ResultMap.STATUS.ERROR);
			result.setStatusCode(ResultMap.STATUS_CODE_SYS_EXCEPTION);
		}
		
		return result;
	}
}
